package com.zywl.api;

import com.zywl.core.beans.Setmeal;
import com.zywl.service.SetmealService;
import com.zywl.utils.models.JsonResult;
import com.zywl.web.controller.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/setmeal/")
public class SetmealApi extends BaseController {
    @Autowired
    private SetmealService setmealService;
    /**
     * 获取收费套餐
     */
    @ResponseBody
    @RequestMapping("list")
    public JsonResult list(String assId){
        JsonResult jr = new JsonResult();
        try {
            Map<String,Object> map = new HashMap<>();
            map.put("sem_association_id",assId);
            map.put("sem_stt","0");
            List<Setmeal> setmealList = setmealService.getListByParams(map);
            jr.success("操作成功",setmealList);
        }catch (Exception e){
            logger.error("获取详情失败",e);
            jr.error("获取详情失败");
        }
        return jr;
    }



}
